import { createSlice } from "@reduxjs/toolkit";
import  axios from "axios";
const billStore = createSlice({
    name:'billStore',
    initialState:{
        billlist: []
    },
    reducers:{
        setbilllist(state,action){
            state.billlist = action.payload
        }
    }
})
const getList = () => {
    return async (dispatch) => {
        const res = await axios.get('http://localhost:8888/ka')
        dispatch(setbilllist(res.data))
        console.log(billStore.billlist);
    }
}
const { setbilllist } = billStore.actions
export { getList }
const reducer = billStore.reducer
export default reducer